
package com.xunji.standard.config;

import feign.codec.Encoder;
import feign.form.spring.SpringFormEncoder;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.cloud.openfeign.support.SpringEncoder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Scope;


/**
 * @program: trial-service
 * @ClassName MultipartSupportConfig
 * @description:
 * @author: qiangxu9
 * @create: 2024-12-30 16:03
 * @Version 1.0.0
 **/

@Configuration
public class MultipartSupportConfig {
    @Autowired
    private ObjectFactory<HttpMessageConverters> messageConverters;

    public MultipartSupportConfig() {
    }

    @Bean
    @Primary
    @Scope("prototype")
    public Encoder feignSpringFormEncoder() {
        return new SpringFormEncoder(new SpringEncoder(messageConverters));
    }
}

